package top.aicey.ai.sparring.common.utils;

import top.aicey.ai.sparring.common.constants.SuccessConstants;
import top.aicey.ai.sparring.common.exception.BaseException;
import top.aicey.ai.sparring.dto.model.BaseResponse;
import top.aicey.ai.sparring.dto.model.ErrorContext;
import top.aicey.ai.sparring.dto.model.SuccessContext;

public class BaseResponseUtil {

    public static BaseResponse buildSuccessResponse() {
        SuccessContext successContext = SuccessConstants.SUCCESS;
        return BaseResponse.getSuccessResponse(successContext, (Object)null);
    }

    public static BaseResponse buildSuccessResponse(Object data) {
        SuccessContext successContext = SuccessConstants.SUCCESS;
        return BaseResponse.getSuccessResponse(successContext, data);
    }

    public static BaseResponse buildSuccessResponse(SuccessContext successContext, Object data) {
        return BaseResponse.getSuccessResponse(successContext, data);
    }

    public static BaseResponse buildFailedResponse(BaseException exception) {
        ErrorContext errorContext = exception.getError();
        return BaseResponse.getFailedResponse(errorContext, exception.getData());
    }

    public static BaseResponse buildFailedResponse(ErrorContext errorContext) {
        return BaseResponse.getFailedResponse(errorContext, (Object)null);
    }

    public static BaseResponse buildFailedResponse(ErrorContext errorContext, Object data) {
        return BaseResponse.getFailedResponse(errorContext, data);
    }
}
